#pragma once

#include <libtcod\libtcod.hpp>
#include "..\Math\Vec2i.h"
#include <memory>

class GameObject
{
public:
	GameObject(const Vec2i &pos, int tile, const TCODColor &color);
	virtual ~GameObject();

	virtual void update() {}
	virtual void render();

	void setPos(const Vec2i &pos) { prev_pos = this->pos; this->pos = pos; }
	void setPos(Vec2i &&pos) { prev_pos = this->pos; this->pos = pos; }
	void setPos(int x, int y) { prev_pos = pos; pos.x() = x; pos.y() = y; }
	const Vec2i &getPos() const { return pos; }
	void translate(int dx, int dy);

	int getTile() const { return tile; }
	const TCODColor &getColor() const { return color; }

protected:
	Vec2i pos;
	Vec2i prev_pos;
	int tile;
	TCODColor color;
};

typedef std::shared_ptr<GameObject> GameObjectPtr;
